﻿using Common.Web.Share;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Authentication.Web.App_Start
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");
            // Here is added new ignore rule
            routes.IgnoreRoute("Reports/{resource}.aspx/{*pathInfo}");
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{code}",
                defaults: new { controller = "Home", action = "Index", code = UrlParameter.Optional }
            ).RouteHandler = RouteHander.Instant;

            routes.MapRoute(
                name: "Default2",
                url: "{controller}/{action}/{code}/{code2}",
                defaults: new { controller = "Home", action = "Index", code = UrlParameter.Optional, code2 = UrlParameter.Optional }
            ).RouteHandler = RouteHander.Instant;

            routes.MapRoute(
                name: "payhis",
                url: "{controller}/{action}/{code}/{code2}/{code3}",
                defaults: new { controller = "payment", action = "history", code = UrlParameter.Optional, code2 = UrlParameter.Optional, code3 = UrlParameter.Optional }
            ).RouteHandler = RouteHander.Instant;

            routes.MapRoute(
                name: "Attendance",
                url: "{controller}/{action}/{code}/{code2}/{code3}/{code4}",
                defaults: new { controller = "Attendance", action = "Summary", code = UrlParameter.Optional, code2 = UrlParameter.Optional, code3 = UrlParameter.Optional, code4 = UrlParameter.Optional }
            ).RouteHandler = RouteHander.Instant;
        }
    }
}